package com;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.Properties;
import org.apache.log4j.Logger;

public class StreamAccessor 
{
    private static volatile StreamAccessor instance;
    private static final Logger logger = Logger.getLogger(StreamAccessor.class);
    private ServerSocket server = null;
    private final String PROPERTIES_FILE= "./config.properties";
    private Properties properties;
    //private BufferedReader inputStream =  null; 
    //private PrintWriter outputStream = null;
    
    private StreamAccessor()
    {
    	try {
			FileInputStream properties_file = new  FileInputStream(PROPERTIES_FILE);
			properties.load(properties_file);
		} catch (FileNotFoundException e) {
			logger.error("Exception in SteamAccessor", e);
			e.printStackTrace();
		}
    	catch (IOException e) {
			logger.error("Exception in SteamAccessor", e);
			e.printStackTrace();
		}
    }
    
    public static StreamAccessor getInstance() 
    {
    	StreamAccessor localInstance = instance;
    	if (localInstance == null) 
    	{
    		synchronized (StreamAccessor.class) 
    		{
    			localInstance = instance;
    			if (localInstance == null) 
    			{
                instance = localInstance = new StreamAccessor();
    			}
    		}
    	}
    return localInstance;
    }
    /*
    public void Initiate (InputStream bufr, OutputStream prw)
    {
    	inputStream = new BufferedReader(new InputStreamReader(bufr));
    	outputStream = new PrintWriter(prw);
    }
    
    public BufferedReader getInputStream()
    {
    	return this.inputStream;
    }
    
    public PrintWriter getOutputStream()
    {
    	return this.outputStream;
    }
    */
}